//
//  CommonUtil.swift
//  NewFeaturesDemo
//
//  Created by VEER on 2022/3/10.
//
import UIKit

public var ScreenSize: CGSize {
    return UIScreen.main.bounds.size
}

public let ScreenMinSize = min(ScreenSize.width, ScreenSize.height)
public let ScreenMaxSize = max(ScreenSize.width, ScreenSize.height)

public var ScreenWidth: CGFloat {
    return ScreenSize.width
}

public var ScreenHeight: CGFloat {
    return ScreenSize.height
}

public var StatusBarHeight: CGFloat {
    return StatusBar_HEIGHT
}

public let IS_IPAD  = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad)

public var SCREEN_KEY_WINDOW: UIWindow? {
    return UIApplication.shared.windows.first(where: {$0.isKeyWindow})
}

public var StatusBar_HEIGHT:CGFloat{
    guard #available(iOS 11.0, *),let top = UIApplication.shared.delegate?.window??.safeAreaInsets.top,top > 0 else{
        return 20
    }
    return top
}

public var NavBarHeight: CGFloat {
    return StatusBar_HEIGHT + 44
}

public var layoutBottom:CGFloat{
    
    guard #available(iOS 11.0, *)else{
        return 0
    }
    return UIApplication.shared.delegate?.window??.safeAreaInsets.bottom ?? 0
}
